# Test script for building Docker images
# This is a simplified version to test the build process

$ErrorActionPreference = "Stop"

Write-Host "Testing Docker image build process..." -ForegroundColor Green

# Get project root directory - Method 2 (3 levels up) is correct
$PROJECT_ROOT = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path))
Write-Host "Project root: $PROJECT_ROOT" -ForegroundColor Cyan

# Test backend build
Write-Host "Testing backend build..." -ForegroundColor Yellow
$serverPath = Join-Path $PROJECT_ROOT "server"
Set-Location $serverPath
if (Test-Path "Dockerfile") {
    Write-Host "✓ Backend Dockerfile found" -ForegroundColor Green
}
else {
    Write-Host "✗ Backend Dockerfile not found" -ForegroundColor Red
    exit 1
}

# Test frontend build
Write-Host "Testing frontend build..." -ForegroundColor Yellow
$webPath = Join-Path $PROJECT_ROOT "web"
Set-Location $webPath
if (Test-Path "Dockerfile") {
    Write-Host "✓ Frontend Dockerfile found" -ForegroundColor Green
}
else {
    Write-Host "✗ Frontend Dockerfile not found" -ForegroundColor Red
    exit 1
}

Write-Host "Test completed successfully!" -ForegroundColor Green 